#include "Pattern.h"
namespace qtangram
{
Pattern::Pattern(QWidget* parent) : ContainerWidget(6.0, parent) {
}
Pattern::Pattern(double viewRange, QWidget *parent) : ContainerWidget(viewRange, parent) {}
void Pattern::paintEvent(QPaintEvent *)
{
    QStyleOption o;
    o.initFrom(this);
    TanPainter painter(this);
    style()->drawPrimitive(QStyle::PE_Widget, &o, &painter, this);
    painter.setPen(Qt::darkGray);
    painter.setBrush(Qt::darkGray);
    for(auto it = patternPolygon.begin(); it != patternPolygon.end(); ++it)
	painter.drawPolygon(CoordinateTransformer::worldToScreen(this, (*it).polyCurrent));
}

void Pattern::setPatternPolygon(QLinkedList<Tan> polygon) {
    patternPolygon = polygon;
}
}

